<!-- 答题授权页-注释文字列表 -->
<template>
    <el-collapse modelValue="1">
        <el-collapse-item title="底部文字列表" name="1">
            <si-collapse-group
                v-model="list"
                is-draggable
                is-add
                is-delete
                add-text="添加文字"
                :add="data => '文案'"
                :node-title="data => data"
            >
                <template #item="{ element, index }">
                    <div class="row-wrap">
                        <div class="left-wrap">
                            内容
                        </div>
                        <div class="right-wrap">
                            <el-input v-model="list[index]" />
                        </div>
                    </div>
                </template>
            </si-collapse-group>
        </el-collapse-item>
    </el-collapse>
</template>

<script>
import { defineComponent, toRefs, computed } from 'vue'
import {
    SiCollapseGroup
} from '@/components/setting-pane/setting-item'
export default defineComponent({
    name: 'QuestionAuthorizationPromptList',
    components: {
        SiCollapseGroup
    },
    props: {
        element: {
            type: Object,
            default: () => ({})
        }
    },
    setup(props) {
        const { element } = toRefs(props)

        const list = computed({
            get: () => element.value.customFeature.promptList,
            set: val => element.value.customFeature.promptList = val
        })

        return {
            list
        }
    }
})
</script>

<style lang="less" scoped>
.row-wrap {
    display: flex;
    align-items: center;
    .left-wrap {
        margin-right: 10px;
    }
    .right-wrap {
        flex: 1;
    }
}
</style>